<div class="main-box-info password text-input">
	<dl>
		<dt id="formPwd">
			<input type="hidden" id="setPwdCallback" value=""> <span
				class="tt">提示：</span> <span class="dred">密码由6至16个字符组成。</span>
		</dt>
		<dd>
			<label for="oldPwd">旧密码：</label> <input type="password"
				type="password" id="oldPwd" value="">
		</dd>
		<dd>
			<label for="newPwd">新密码：</label> <input type="password"
				type="password" id="newPwd" value=""> <span>（注意：不可与资金密码一致）</span>
		</dd>
		<dd>
			<label for="rePwd">确认登录新密码：</label> <input type="password"
				type="password" id="rePwd" value="">
		</dd>
		<dd>
			<button  onclick="editPwd()">确认修改</button>
		</dd>
	</dl>
</div>
<script type="text/javascript">
	function editPwd() {
		var userPassword = $.trim($("#oldPwd").val());
		var newUserPassword = $.trim($("#newPwd").val());
		var confirmUserPassword = $.trim($("#rePwd").val());
		var pwdRule = /^.{4,16}$/; 
		if(userPassword == ''){
			$("#oldPwd").select();
			return popTips("原始密码不能为空","error");
		}
		if(newUserPassword == ''){
			$("#newPwd").select();
			return popTips("新密码不能为空","error");
		} 
		if(!pwdRule.test(newUserPassword)){
			$("#newPwd").select();
			return popTips("密码长度应在6到16个字符之间'","error");
		} 
		if(confirmUserPassword == ''){
			$("#rePwd").select();
			return popTips("确认密码不能为空","error");
		}
	
		if(confirmUserPassword != newUserPassword){
			$("#rePwd").select();
			return popTips("两次输入密码不一致","error");
		}
		var dataStr = $.substitute(
						'userPassword={userPassword}&newUserPassword={newUserPassword}&r={curTime}',
						{
							userPassword : userPassword,
							newUserPassword : newUserPassword,
							curTime : new Date().getTime()
						});
		$.ajax({
			url : "/user/mdUserPasswd",
			method : 'POST',
			data : dataStr,
			success : function(result) {
				//var result =eval("("+data+")");
				if (result.retcode == '0') {
					return popTips("修改成功！","succeed");
				}
				return popTips(result.retmsg,"error");
			}
		});
	}
</script>